/*
 * Copyright 2008 - 2009 Lars Heuer (heuer[at]semagia.com). All rights reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.semagia.atomico.server.impl.restlet.resources;

import java.util.Collections;
import java.util.List;

import org.restlet.data.CharacterSet;
import org.restlet.data.Encoding;
import org.restlet.data.Language;
import org.restlet.data.Reference;
import org.restlet.representation.Variant;

/**
 * Represents an immutable variant. 
 * 
 * The variant has just a media type and all attempts to modify the variant's
 * data result in a UnsupportedOperationException.
 * 
 * @author Lars Heuer (heuer[at]semagia.com) <a href="http://www.semagia.com/">Semagia</a>
 * @version $Rev: 66 $ - $Date: 2010-09-06 15:29:07 +0000 (Mon, 06 Sep 2010) $
 */
final class ImmutableVariant extends Variant {

    /**
     * Initializes the immutable variant with the specified media type.
     *
     * @param mediaType The media type.
     */
    public ImmutableVariant(org.restlet.data.MediaType mediaType) {
        super(mediaType);
        if (mediaType == null) {
            throw new IllegalArgumentException("The media type must not be null");
        }
    }

    /* (non-Javadoc)
     * @see org.restlet.representation.Variant#getEncodings()
     */
    @Override
    public List<Encoding> getEncodings() {
        return Collections.emptyList();
    }

    /* (non-Javadoc)
     * @see org.restlet.representation.Variant#getLanguages()
     */
    @Override
    public List<Language> getLanguages() {
        return Collections.emptyList();
    }

    /* (non-Javadoc)
     * @see org.restlet.representation.Variant#setCharacterSet(org.restlet.data.CharacterSet)
     */
    @Override
    public void setCharacterSet(CharacterSet characterSet) {
        throw new UnsupportedOperationException();
    }

    /* (non-Javadoc)
     * @see org.restlet.representation.Variant#setEncodings(java.util.List)
     */
    @Override
    public void setEncodings(List<Encoding> encodings) {
        throw new UnsupportedOperationException();
    }

    /* (non-Javadoc)
     * @see org.restlet.representation.Variant#setIdentifier(org.restlet.data.Reference)
     */
    @Override
    public void setIdentifier(Reference identifier) {
        throw new UnsupportedOperationException();
    }

    /* (non-Javadoc)
     * @see org.restlet.representation.Variant#setIdentifier(java.lang.String)
     */
    @Override
    public void setIdentifier(String identifierUri) {
        throw new UnsupportedOperationException();
    }

    /* (non-Javadoc)
     * @see org.restlet.representation.Variant#setLanguages(java.util.List)
     */
    @Override
    public void setLanguages(List<Language> languages) {
        throw new UnsupportedOperationException();
    }

    /* (non-Javadoc)
     * @see org.restlet.representation.Variant#setMediaType(org.restlet.data.MediaType)
     */
    @Override
    public void setMediaType(org.restlet.data.MediaType mediaType) {
        throw new UnsupportedOperationException();
    }

}
